package weifei.live.simulation.filter;


import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;


@WebFilter
public class ResultFilter implements Filter
{

    @Override
    public void init(FilterConfig filterConfig)
            throws ServletException
    {
        Filter.super.init(filterConfig);
        System.out.println("ResultFilter init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException
    {
        //System.out.println("ResultFilter doFilter");
        servletRequest.setCharacterEncoding("UTF-8");
        servletResponse.setCharacterEncoding("UTF-8");
        servletResponse.setContentType("application/json;charset=UTF-8");
        filterChain.doFilter(servletRequest, servletResponse);
    }
}


